<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>人员信息</title>
    <link rel="stylesheet" href="/lib/layui/layui/css/layui.css">
    <link rel="stylesheet" href="/lib/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/common.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/eleTree.css">
    <script type="text/javascript" src="/lims/layui/global.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/js/common/fileupload.js"></script>
    <script type="text/javascript" src="/js/meeting/jquery.qrcode.min.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/global.js/"></script>
    <script src="/lib/layui/layui/js/baseCode/base.js?v=2019080918:09" type="text/javascript" charset="utf-8"></script>
    <style>
        html, body {
            width: 99%;
            height: 99%;
        }

        .layui-tab {
            height: 98%;
        }

        .layui-tab-content {
            height: calc(100% - 50px)
        }

        .layui-tab-item, .layui-card {
            height: 100%;
        }
        /*.layui-table-tool{*/
            /*display: none!important;*/
        /*}*/
        .layui-tab {
            margin: -8px 0;
            text-align: left!important;
        }
    </style>

</head>
<body style="background-color: white;padding: 5px">
<div class="layui-tab">

    <div class="layui-tab-content">

        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">已报名并签到人员</li>
                <li>已报名未签到人员</li>
                <li>未报名人员</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <table id="Settlement1" lay-filter="SettlementFilter1"></table>
                </div>
                <div class="layui-tab-item">
                    <table id="Settlement2" lay-filter="SettlementFilter2"></table>
                </div>
                <div class="layui-tab-item">
                    <table id="Settlement3" lay-filter="SettlementFilter3"></table>
                </div>

            </div>
        </div>

    </div>
</div>
<script type="text/html" id="barOperation">
    <a class="layui-btn layui-btn-xs" lay-event="ping" id="ping">评估</a>
</script>
<script type="text/html" id="out1">
    <button type="button" class="layui-btn" id="outport1">导出</button>
</script>
<script type="text/html" id="out2">
    <button type="button" class="layui-btn" id="outport2">导出</button>
</script>
<script type="text/html" id="out3">
    <button type="button" class="layui-btn" id="outport3">导出</button>
</script>
<script type="text/javascript">
    var courseId = $.GetRequest().courseId;
    var scheduleId = $.GetRequest().scheduleId;
    var courseLecturer = decodeURI($.GetRequest().courseLecturer);
    var courseName = decodeURI($.GetRequest().courseName);
    var courseType = $.GetRequest().courseType;
    $('#back').click(function(){
        window.location.href = '/course/courseCon?courseId='+courseId+'&courseLecturer='+encodeURI(courseLecturer)+'&courseName='+encodeURI(courseName)+'&courseType='+courseType+'&type=0';
    })
    layui.use('element', function () {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function () {
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项' + (Math.random() * 1000 | 0) //用于演示
                    , content: '内容' + (Math.random() * 1000 | 0)
                    , id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }
            , tabDelete: function (othis) {
                //删除指定Tab项
                element.tabDelete('demo', '44'); //删除：“商品管理”


                othis.addClass('layui-btn-disabled');
            }
            , tabChange: function () {
                //切换到指定Tab项
                element.tabChange('demo', '22'); //切换到：用户管理
            }
        };

        $('.site-demo-active').on('click', function () {
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function (elem) {
            location.hash = 'test=' + $(this).attr('lay-id');
        });

    });
    var first;
    var sencond;
    layui.use(['table', 'layer', 'laydate', 'form', 'element', 'eleTree'], function () {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , carousel = layui.carousel //轮播
            , upload = layui.upload //上传
            , element = layui.element //元素操作
            , slider = layui.slider //滑块
            ,form = layui.form
            ,$ = layui.jquery;
        //执行一个 table 实例
        table1 = table.render({
            elem: '#Settlement1'
            , url: '/trCourseManage/showSome?scheduleId='+scheduleId //数据接口
            , title: '报名信息表'
            , page: true //开启分页
            ,toolbar: '#out1'
            , defaultToolbar: []
            , cols: [[ //表头
                {field: 'signupId', title: 'ID', sort: true, fixed: 'left', hide: true}
                // , {field: 'signupCourse', title: '课程名称',}
                , {field: 'deptName', title: '部门名称',}
                , {field: 'userName', title: '人员姓名',}
                , {field: 'mobilNo', title: '手机号',}
                , {field: 'categoryName', title: ' 品类',}
                , {field: 'brandName', title: '品牌',}
                , {field: 'signupTime', title: '报名时间', sort: true,}
                , {field: 'signinTime', title: '签到时间', sort: true}
                , {field: 'content', title: '评估内容'}
            ]]

        });
        table.on('toolbar(Settlement1)', function (obj) {
            switch (obj.event) {
                case 'add':
                    editAdd(0, 0);
                    break;
                case 'back':
                    window.location.href = '/course/index';
                    break;
            }
            ;
        });
        table1 = table.render({
            elem: '#Settlement2'
            , url: '/trCourseManage/showSome?scheduleId='+scheduleId //数据接口
            , title: '报名信息表'
            , page: true //开启分页
            ,toolbar: '#out2'
            ,defaultToolbar: []
            , cols: [[ //表头
                {field: 'signupId', title: 'ID', sort: true, fixed: 'left', hide: true}
                // , {field: 'signupCourse', title: '课程名称',}
                , {field: 'deptName', title: '部门名称',}
                , {field: 'userName', title: '人员姓名',}
                , {field: 'mobilNo', title: '手机号',}
                , {field: 'categoryName', title: ' 品类',}
                , {field: 'brandName', title: '品牌',}
                , {field: 'signupTime', title: '报名时间', sort: true,}
                , {field: 'signinTime', title: '签到时间', sort: true}
                , {field: 'content', title: '评估内容'}
                // ,{fixed: 'right',width:150, title: '操作',align:'center', toolbar: '#barOperation'}
            ]]
            ,parseData: function(res){ //res 即为原始返回的数据
                var len=0;
                var data = []
                console.log(res.object)
                if(res.object!=''&&res.object!=undefined){
                    if(res.object.length>0){
                        len = res.object.length
                        data = res.object
                    }
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": len, //解析数据长度
                    "data": data //解析数据列表
                };
            }
        });
        table1 = table.render({
            elem: '#Settlement3'
            , url: '/trCourseManage/queryOther?scheduleId='+scheduleId //数据接口
            , title: '报名信息表'
            , page: true //开启分页
            ,toolbar: '#out3'
            ,defaultToolbar: []
            , cols: [[ //表头
                {field: 'signupId', title: 'ID', sort: true, fixed: 'left', hide: true}
                // , {field: 'signupCourse', title: '课程名称',}

                , {field: 'deptName', title: '部门名称',}
                , {field: 'userName',align:'center', title: '未报名人员',}
                , {field: 'mobilNo', title: '手机号',}
                , {field: 'categoryName', title: ' 品类',}
                , {field: 'brandName', title: '品牌',}

                // ,{fixed: 'right',width:150, title: '操作',align:'center', toolbar: '#barOperation'}
            ]]

        });
        $('#outport1').click(function(){

            window.location.href = '/trCourseManage/showSome?export=1&scheduleId='+scheduleId
        })
        $('#outport2').click(function(){

            window.location.href = '/trCourseManage/showSome?export=2&scheduleId='+scheduleId
        })
        $('#outport3').click(function(){

            window.location.href = '/trCourseManage/queryOther?export=1&scheduleId='+scheduleId
        })

        table.on('tool(SettlementFilter1)', function(obj){//注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的DOM对象
            var signupId= data.signupId;
            var urlTitle='/course';
            if(layEvent === 'ping'){
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['400px', '350px'], //宽高
                    title:'评估',
                    maxmin: true,
                    btn: ['<div style="background:none;border:none;color:#fff" id="lay-submit">确定</div>', '取消'],
                    content:'<div class="layui-card" ><form class="layui-form" id="ajaxform" action="">' +
                    '<div class="layui-form-item" >\n' +
                    ' \n' +
                    '  <div class="layui-inline" style="margin-top:25px;">\n' +
                    '    <label class="layui-form-label">评语</label>\n' +
                    '    <div class="layui-input-inline" style="">\n' +
                    '      <textarea name="content" id="content" placeholder="请输入内容" class="layui-textarea"></textarea>\n' +
                    '    </div>\n' +
                    '  </div>\n' +
                    '</div>' +
                    '<div class="layui-form-item" style="margin-top:25px;">\n' +
                    ' \n' +
                    '  <div class="layui-inline">\n' +
                    '    <label class="layui-form-label">评分</label>\n' +
                    '    <div class="layui-input-inline" style="">\n' +
                    '      <input type="text" name="fraction" id="fraction" placeholder="" autocomplete="off" class="layui-input">\n' +
                    '    </div>\n' +
                    '  </div>\n' +
                    '</div>' +
                        '</form></div>'
                    ,yes:function(){
                        $.ajax({
                            url:'/signUp/changeFraction',
                            data:{signupId:signupId,fraction:$('#fraction').val(),content:$('#content').val()},
                            dataType:'json',
                            success:function(res){

                                    $.layerMsg({content:res.msg,icon:1})
                                location.reload()
                                layer.closeAll();
                            }
                        })
                    }
                })
            }
        });
        $("#searchButton2").click(function () {
            first = $("#signupUser").val();
            sencond = $("#signupCourse").val();
            table.reload('Settlement1', {
                url: "/signUp/showAll",
                where: {
                    signupUser: first,
                    signupCourse: sencond
                }
            });


        })




    });


</script>

</body>


</html>